#pragma once
#include <d3d11.h>
#include <directxcolors.h>
#include <string>
#include "SpriteBatch.h"
#include "SpriteFont.h"
#include "IComponent.h"
#include "IRenderable.h"

using namespace DirectX;

class Graphics : virtual public IComponent, IRenderable
{
public:
	Graphics(void);
	~Graphics(void);

	virtual void Initialize(HWND WindowHandle = nullptr, HINSTANCE hInstance = nullptr, ID3D11Device* Device = nullptr, ID3D11DeviceContext* DeviceContext = nullptr);
	virtual void Update(int DeltaTime);
	virtual void Shutdown();

	virtual void Render();

	void RenderText(std::string Text, float x, float y);
	void Present();

	ID3D11Device* GetDevice();
	ID3D11DeviceContext* GetDeviceContext();
	ID3D11RenderTargetView* GetRenderTarget();
	IDXGISwapChain* GetSwapChain();

private:
	ID3D11Device*           D3DDevice;
	ID3D11DeviceContext*    D3DDeviceContext;
	IDXGISwapChain*         SwapChain;
	ID3D11RenderTargetView* RenderTargetView;

	std::unique_ptr<SpriteBatch> spriteBatch;
    std::unique_ptr<SpriteFont> spriteFont;
};